CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

include_directories(${PROJECT_ROOT})
include_directories(${PROJECT_ROOT}/comn/include)
include_directories(.)
include_directories(include)
include_directories(util)
include_directories(src)
include_directories(core)
include_directories(sdl)


include_directories(${FFMPEG_INCLUDE_DIR})
include_directories(${THIRD_PARTY}/SDL2/include)
include_directories(${THIRD_PARTY}/jsoncpp-1.8.4/include)

if (CMAKE_HOST_WIN32)
	include_directories(win)
	
	if (MSVC)
		include_directories(${THIRD_PARTY}/wtl81/Include)
		include_directories(${THIRD_PARTY}/stdint)
	endif()
endif()

link_directories(${PROJECT_ROOT}/comn/lib)
link_directories(${PROJECT_ROOT}/lib)
link_directories(${FFMPEG_LIBRARY_DIR})
link_directories(${THIRD_PARTY}/SDL2/lib/x86)
link_directories(${THIRD_PARTY}/SDL2/lib)

aux_source_directory(. SOURCE)
aux_source_directory(core SOURCE)
aux_source_directory(src SOURCE)
aux_source_directory(util SOURCE)
aux_source_directory(sdl UI_SOURCE)

FILE(GLOB HEADER "*.h")


if (CMAKE_HOST_WIN32)
	aux_source_directory(win UI_SOURCE)
	
	if (MSVC)
		
	else()
		list(REMOVE_ITEM UI_SOURCE win/WtlVideoWindow.cpp)
	endif()	
else()
	list(REMOVE_ITEM SOURCE src/CMediaFileReader.cpp)
	list(REMOVE_ITEM SOURCE src/NvmFileSource.cpp)
endif()


add_library(LitePlayer SHARED ${SOURCE} ${HEADER} ${UI_SOURCE} LitePlayer.rc)

target_link_libraries(LitePlayer
    debug comnd optimized comn
	SDL2 SDL2main 
	debug jsoncppd optimized jsoncpp
	${LIB_PLATFORM}
	${FFMPEG_LIBRARIES}
	)

set_target_properties(LitePlayer PROPERTIES LINK_INTERFACE_LIBRARIES "")
set_target_properties(LitePlayer PROPERTIES INTERFACE_LINK_LIBRARIES "")
set_target_properties(LitePlayer PROPERTIES LINK_FLAGS_RELEASE "/OPT:NOREF")


install(TARGETS LitePlayer DESTINATION lib)

install(DIRECTORY ${PROJECT_ROOT}/LitePlayer/include/ DESTINATION LitePlayer/include FILES_MATCHING PATTERN "*.h")